package com.merry.boot.config;

import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.boot.web.servlet.ServletListenerRegistrationBean;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


/**
 * @author msi
 * 使用spring提供的注册组件RegistrationBean为我们注入servlet、filter、listener。
 */
//@Configuration
public class MyRegistConfig {

    @Bean
    public ServletRegistrationBean myServlet(){
//        MyServlet myServlet = new MyServlet();
//        return new ServletRegistrationBean(myServlet,"/my","/my02");
        return null;
    }


    @Bean
    public FilterRegistrationBean myFilter(){
//        MyFilter myFilter = new MyFilter();
//        FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean(myFilter);
//        filterRegistrationBean.setUrlPatterns(Arrays.asList("/my","/css/*"));
//        return filterRegistrationBean;
        return null;
    }

    @Bean
    public ServletListenerRegistrationBean myListener(){
//        MySwervletContextListener mySwervletContextListener = new MySwervletContextListener();
//        return new ServletListenerRegistrationBean(mySwervletContextListener);
        return null;
    }
}